package com.shxzz.easy12306.services.order.service;

import com.shxzz.easy12306.framework.starter.common.dto.order.CloseTicketOrderReqDTO;
import com.shxzz.easy12306.framework.starter.common.dto.order.TicketOrderCreateReqDTO;
import com.shxzz.easy12306.framework.starter.common.mq.event.PayResultCallbackOrderEvent;
import com.shxzz.easy12306.framework.starter.convention.page.PageResponse;
import com.shxzz.easy12306.services.order.dto.domain.OrderItemStatusTransition;
import com.shxzz.easy12306.services.order.dto.req.TicketOrderPageQueryReqDTO;
import com.shxzz.easy12306.services.order.dto.req.TicketOrderSelfPageQueryReqDTO;
import com.shxzz.easy12306.framework.starter.common.dto.order.TicketOrderDetailRespDTO;
import com.shxzz.easy12306.services.order.dto.resp.TicketOrderDetailSelfRespDTO;

/**
 * 订单服务层接口
 */
public interface OrderService {

    /**
     * 创建订单
     * @return 订单号
     */
    String createTicketOrder(TicketOrderCreateReqDTO requestParam);

    /**
     * 根据订单号查询订单信息
     */
    TicketOrderDetailRespDTO queryTicketOrderByOrderSn(String orderSn);

    /**
     * 根据条件分页查询订单
     */
    PageResponse<TicketOrderDetailRespDTO> pageTicketOrder(TicketOrderPageQueryReqDTO requestParam);

    /**
     * 分页查询本人车票订单,
     */
    PageResponse<TicketOrderDetailSelfRespDTO> pageSelfTicketOrder(TicketOrderSelfPageQueryReqDTO requestParam);

    /**
     * 关闭订单
     * @return {@link Boolean#FALSE} 关闭失败，不满足关闭要求或已关闭 {@link Boolean#TRUE} 关闭成功，操作数据库关闭
     */
    Boolean closeTicketOrder(CloseTicketOrderReqDTO requestParam);

    /**
     * 支付回调修改订单状态
     */
    void payCallback(PayResultCallbackOrderEvent payResultCallbackOrderEvent);

    /**
     * 退款回调修改订单状态
     */
    void refundCallback(OrderItemStatusTransition orderItemStatusTransition);
}
